package com.company;

import javax.xml.crypto.Data;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.*;
import java.time.temporal.TemporalAmount;
import java.util.Date;
import java.util.SimpleTimeZone;
import java.util.logging.SimpleFormatter;

public class DataClass {
    public DataClass() throws ParseException {

//        dateCode dc = new dateCode();
//        javaTime jt = new javaTime();
        ZoneDateTimeClass zt = new ZoneDateTimeClass();
    }

}
class javaTime {
    public javaTime() {
        LocalDate nowD = LocalDate.now();
        LocalTime nowT = LocalTime.now();
        LocalDateTime ldt = LocalDateTime.of(2016,11,30,15,16,17);
        LocalDate ldt1 = LocalDate.of(2021,3,2);
        LocalTime ldt2 = LocalTime.of(15,14,12);
        LocalDateTime LDT = LocalDateTime.of(ldt1,ldt2);
        System.out.println(nowD);
        System.out.println(nowT);
        System.out.println(ldt);
        System.out.println(LDT);

//        计算相差多久
        LocalDate lds1 = LocalDate.of(100,10,10);
        LocalDate lds2 = LocalDate.of(200,12,10);
        Period pi = lds1.until(lds2);
        System.out.println(pi);

    }
}
// 时区API
class ZoneDateTimeClass{
    public ZoneDateTimeClass() {
        ZonedDateTime zd = ZonedDateTime.now();
        ZonedDateTime zny = ZonedDateTime.now(ZoneId.of("America/New_York"));
        Instant ins = Instant.now();
        System.out.println(zd);
        System.out.println(zny);
        System.out.println(zd.toInstant());
        System.out.println(ins.getEpochSecond());

    }
}
class dateCode{
    public dateCode() {
        //        Date data = new Date();
//        int d = data.getHours();
//        SimpleDateFormat sm = new SimpleDateFormat();
//        String s3 = "2021-11-12 12:22:33";
//        SimpleDateFormat sm2 = new SimpleDateFormat("MM/dd/yyyy/ HH:mm:ss Z");
//        Date sm3 = new SimpleDateFormat("MMM/dd/yyyy/ HH:mm:ss Z").parse(s3);
//        System.out.println(data);
//        System.out.println(data.getTime());
//        System.out.println(data.toString());
//        System.out.println(d);
//        System.out.println(sm);
//        System.out.println(sm.format(data));
//        System.out.println(sm2.format(data));
//        System.out.println(sm2.format(data));
//        System.out.println(sm.format(sm3));
    }
}
class CalendarClass{
    public CalendarClass() {
    }
}
